package Test;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class test {

	public static void main(String[] args) {
		Queue<Integer> qa = new LinkedList<Integer>();
		Queue<Integer> qb = new LinkedList<Integer>();
		Scanner input=new Scanner (System.in);
		String s;
		s=input.nextLine();
		String[] str=s.split(" ");
		int num;
		int size=Integer.parseInt(str[0]);
		int[]list=new int[size];
		for(int i=1;i<size+1;i++)
		{
			num=Integer.parseInt(str[i]);
			if(num%2==0) qb.offer(num);
			else qa.offer(num);
		}
		for(int i=0;i<str.length-1;)
		{
			if(qa.size()!=0&&i<str.length-1) list[i++]=qa.poll();
			if(qa.size()!=0&&i<str.length-1) list[i++]=qa.poll();
			if(qb.size()!=0&&i<str.length-1) list[i++]=qb.poll();
		}
		for(int i=0;i<str.length-1;i++)
		{
			if(i!=str.length-2) System.out.printf("%d ",list[i]);
			else System.out.printf("%d",list[i]);
		}
	}

}
